unit DlgshowUnit;

interface

uses
  Windows, Messages,Classes, Forms;

type
  TDlgshowThread = class(TThread)
  private
    Thencaption:string;
    Theninfo:string;
    Thenico:integer;
    Thenbtn:integer;
  protected
    procedure Execute; override;
  Public
    constructor Create(caption:string;info:string;ico:integer;btn:integer);
    destructor Destroy; override;
  end;

implementation 
uses Main;

constructor TDlgshowThread.Create(caption:string;info:string;ico:integer;btn:integer);
begin
   inherited Create(True);
   
    Thencaption:=caption;
    Theninfo:=info;
    Thenico:=ico;
    Thenbtn:=btn;
    
   FreeOnTerminate:=True;
   Suspended := false;
end;

procedure TDlgshowThread.Execute;
var i,j:integer;
begin
try
 case Thenbtn of
        0:j:=MB_OK;
        1:j:=MB_OKCANCEL;
        2:j:=MB_YESNO;
        3:j:=MB_YESNOCANCEL;
        4:j:=MB_RETRYCANCEL;
        5:j:=MB_ABORTRETRYIGNORE;
        end;
   case Thenico of
        0:i:=mb_iconInformation;
        1:i:=MB_ICONQUESTION ;
        2:i:=mb_iconwarning;
        3:i:=mb_iconerror;
        end;
  Application.MessageBox(pchar(Thencaption),pchar(Theninfo),j+i+mb_topmost);
except
end;    
self.Terminate;
end;
destructor TDlgshowThread.Destroy;
begin
  inherited destroy;
end;
end.
